import { Form, Input, Image, Table, Popconfirm, Space, Select, Upload } from 'antd'
import './Tim.scss'
import { UploadOutlined, InboxOutlined } from '@ant-design/icons';
import yinye from '../../static/images/yingyezhizhao.png'
import { useEffect, useState } from 'react';
import http from '../../utils/http'
import Avatar from './Upload'
import store from '../../store/index'

const TimBase = () => {
    const [form] = Form.useForm();
    const [src, setSrc] = useState('')
    const [src2, setSrc2] = useState('')
    useEffect(() => {
        let tabledata = store.zengjiayu.timdetailid
        console.log(store.zengjiayu.timdetailid)
        http({
            url: '/peree_Comments/findPeree_CommentsById',
            method: 'post',
            params: {
                perId: tabledata.perId
            }
        }).then((res) => {
            // setData(res.data)
            console.log(res.data);
            if (res.code == 200) {
                //对数据进行处理
                let mydata = res.data[0]
                if (mydata.ten_Id == 0) {
                    mydata.ten_Id = "A1幢"
                }
                else if (mydata.ten_Id == 2) {
                    mydata.ten_Id = "B2幢"
                }
                else {
                    mydata.ten_Id = "C3幢"
                }

                if (mydata.per_large == 0) {
                    mydata.ten_Id = "特大型"
                }
                else if (mydata.per_large == 2) {
                    mydata.ten_Id = "大型"
                }
                else {
                    mydata.per_large = "中型"
                }
                form.setFieldsValue({
                    perId: mydata.perId,
                    perName: tabledata.per_Name,
                    per_SocialCode: tabledata.per_SocialCode,
                    per_industry: mydata.perIndustry,
                    per_isNew: mydata.per_isNew == 0 ? '是' : '否',
                    per_large: mydata.per_large,
                    per_listed: mydata.per_listed == 0 ? '是' : '否',
                    per_logo: mydata.perLogo,
                    per_money: mydata.perMoney,
                    per_type: mydata.per_type,
                    per_valuation: mydata.perValuation,
                    person_id: mydata.person_id,
                    room_id: mydata.roomNo,
                    ten_Id: mydata.ten_Id.toString(),
                    person_name: tabledata.person_name,
                    perPhone: tabledata.perPhone,
                    perLicense: mydata.perLicense
                })
                setSrc(mydata.per_logo)
                setSrc2(mydata.perLicense)
            }
        })
    }, [])
    return (
        <Form
            form={form}
            name="basic"
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 16 }}
            initialValues={{ remember: true }}
            autoComplete="off"
            className='timbaseform'
        >
            <div>
                <Form.Item
                    label="租户姓名"
                    name="perName"
                    rules={[{ required: true }]}
                    disabled
                >
                    <Input disabled />
                </Form.Item>
                <Form.Item
                    label="社会信用代码"
                    name="per_SocialCode"
                    rules={[{ required: true }]}
                    disabled
                >
                    <Input disabled />
                </Form.Item>
                <Form.Item
                    label="所属行业"
                    name="per_industry"
                    rules={[{ required: true }]}
                    disabled
                >
                    <Select disabled>
                        <Select.Option value="信息传输、软件和信息技术务业">
                            信息传输、软件和信息技术务业
                        </Select.Option>
                        <Select.Option value="金融业">
                            金融业
                        </Select.Option>
                        <Select.Option value="住宿和餐饮业">
                            住宿和餐饮业
                        </Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item
                    name="per_isNew"
                    label="是否高新"
                    rules={[{ required: true }]}
                >
                    <Select disabled>
                        <Select.Option value="0">
                            是
                        </Select.Option>
                        <Select.Option value="1">
                            否
                        </Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item
                    name="perLicense"
                    label="营业执照"
                    rules={[
                        {
                            required: true,
                        },
                    ]}
                >
                    <Image
                        width={100}
                        src={src}
                    />
                </Form.Item>
            </div>
            <div>
                <Form.Item
                    name="ten_Id"
                    label="所属楼宇"
                    rules={[{ required: true }]}
                >
                    <Select disabled>
                        <Select.Option value="A1幢">
                            A1幢
                        </Select.Option>
                        <Select.Option value="B2幢">
                            B2幢
                        </Select.Option>
                        <Select.Option value="C3幢">
                            C3幢
                        </Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item
                    name="person_name"
                    label='负责人姓名'
                    rules={[{ required: true }]}
                ><Input disabled />
                </Form.Item>
                <Form.Item
                    name="per_large"
                    label="企业规模"
                    rules={[{ required: true }]}
                >
                    <Select disabled>
                        <Select.Option value="特大型">
                            特大型
                        </Select.Option>
                        <Select.Option value="大型">
                            大型
                        </Select.Option>
                        <Select.Option value="中型">
                            中型
                        </Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item
                    name="per_listed"
                    label="是否上市"
                    rules={[{ required: true }]}
                >
                    <Select disabled>
                        <Select.Option value="是">
                            是
                        </Select.Option>
                        <Select.Option value="否">
                            否
                        </Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item label="企业LOGO"
                    name="buildingImage"
                    rules={[{ required: true }]}
                    style={{
                        flex: '1',
                    }}>
                    <Image
                        width={100}
                        src={src2}
                    />
                    {/* <Avatar></Avatar> */}
                </Form.Item>
            </div>
            <div>
                <Form.Item
                    label="房间名称"
                    name="room_id"
                    rules={[{ required: true }]}
                    style={{
                        flex: '1',
                    }}

                >
                    <Input disabled />
                </Form.Item>
                <Form.Item
                    label="联系方式"
                    name="perPhone"
                    rules={[{ required: true }]}
                    style={{
                        flex: '1',
                    }}
                >
                    <Input disabled />
                </Form.Item>
                <Form.Item
                    label="注册资金"
                    name="per_money"
                    style={{
                        flex: '1',
                    }}
                >
                    <Input disabled />
                </Form.Item>
                <Form.Item
                    label="企业估值"
                    name="per_valuation"
                    style={{
                        flex: '1',
                    }}
                >
                    <Input disabled />
                </Form.Item>
            </div>
        </Form>
    )
}
export default TimBase